package sc.love.boot.dubbo;

import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ProtocolConfig;
import com.alibaba.dubbo.config.ProviderConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import org.springframework.context.annotation.Bean;

/**
 * @ClassName DubboConfig
 * @Description dubbo配置类  主要用于springMVC 暂时无用
 * @Author 15393
 * @Date 2020/5/31 16:19
 * @Version V1.0
 */
//@Configuration
//@EnableDubbo(scanBasePackages = "sc.love.boot.service")
public class DubboConfig {


    @Bean
    public ProviderConfig providerConfig() {
        ProviderConfig providerConfig = new ProviderConfig();
        providerConfig.setTimeout(1000);
        return providerConfig;
    }

    @Bean
    public RegistryConfig registryConfig() {
        RegistryConfig registryConfig = new RegistryConfig();
        registryConfig.setAddress("47.96.238.1");
        registryConfig.setPort(2181);
        registryConfig.setProtocol("zookeeper");
        return registryConfig;
    }

    @Bean
    public ProtocolConfig protocolConfig(){
        ProtocolConfig protocolConfig = new ProtocolConfig();
        protocolConfig.setPort(21810);
        protocolConfig.setName("dubbo");
        return protocolConfig;
    }

    @Bean
    public ApplicationConfig applicationConfig() {
        ApplicationConfig applicationConfig = new ApplicationConfig();
        applicationConfig.setName("service");
        applicationConfig.setOwner("love");
        return applicationConfig;
    }
}